<?php
    include 'connectdb.php';
    if(empty($_SESSION['user'])){
        echo '<script language="javascript">alert("เข้าสู่ระบบก่อนค่ะ");</script>';
        echo '<script language="javascript">window.location="index.php"</script>';
    }
    $q = "select * from home_stay_room where home_stay_room_id =".$_GET[r_id];
    $result = mysqli_query($link, $q);
    $row = mysqli_fetch_array($result);
    $h_id = $row['home_stay_id'];
    $r_name = $row['home_stay_room_name'];
    
    $q2 = "select * from home_stay where home_stay_id =".$h_id;
    $result2 = mysqli_query($link, $q2);
    $row2 = mysqli_fetch_array($result2);
    $h_name = $row2['home_stay_name'];
?>
<table width='764'>
    <tr>
        <td align='center'>
            <form name="frmBooking" method="post" action="booking_room_save.php">
            <table border='1' cellspacing='0' cellpadding='3'>
                <tr>
                    <td colspan='2' width='400' align='center'><strong>ยืนยันการจอง</strong></td>
                </tr>
                <tr>
                    <td width='200' align='right'>ชื่อ Home Stay&nbsp;:</td>
                    <td width='200'><?php echo $h_name?><input type="hidden" name="h_h_id" id="h_h_id" value="<?php echo $h_id;?>"></td>
                </tr>
                <tr>
                    <td width='200' align='right'>ชื่อห้อง&nbsp;:</td>
                    <td width='200'><?php echo $r_name;?><input type="hidden" name="h_r_id" id="h_r_id" value="<?php echo $_GET[r_id];?>"></td>
                </tr>
                <tr>
                    <td width='200' align='right'>Check-in&nbsp;:</td>
                    <td width='200'><?php echo $_GET['date1'];?><input type="hidden" name="h_date1" id="h_date1" value="<?php echo $_GET['date1'];?>"></td>
                </tr>
                <tr>
                    <td width='200' align='right'>Check-out&nbsp;:</td>
                    <td width='200'><?php echo $_GET['date2'];?><input type="hidden" name="h_date2" id="h_date2" value="<?php echo $_GET['date2'];?>"></td>
                </tr>
                <tr>
                    <td width='200' align='right'>ราคา&nbsp;:</td>
                    <td width='200'>
                        <?php echo $_GET['price'];?>&nbsp;บาท&nbsp;(<?php echo $_GET['night'];?>&nbsp;วัน)
                        <input type="hidden" name="h_price" id="h_price" value="<?php echo $_GET['price'];?>">
                        <input type="hidden" name="h_n" id="h_n" value="<?php echo $_GET['night'];?>">
                    </td>
                </tr>
                <tr>
                    <td width='200' align='right'>ค่าจอง&nbsp;:</td>
                    <td width='200'>
                        ขั้นต่ำ&nbsp;<?php echo $_GET['deposit'];?><input type="hidden" name="h_deposit" id="h_deposit" value="<?php echo $_GET['deposit'];?>">&nbsp;บาท
                        
                    </td>
                </tr>
                <tr>
                    <td colspan='2' align="center"><input type='submit' name='btnSaveBooking' value="ยืนยัน" style="width :250px" class="btn btn-warning"/></td>
                </tr>
            </table>
            </form>    
        </td>
    </tr>
</table>   